<div id="container">
<p id="description"></p>
<div id="sample">foobarbaz</div>
</div>
<script src="../../resources/js-test.js"></script>
<script>
description('Check selection updated after splitText.');
function $(id) { return document.getElementById(id); }
var range = document.createRange();
range.setStart($('sample').firstChild, 6);
range.setEnd($('sample').firstChild, $('sample').firstChild.length);
var selection = getSelection();
selection.removeAllRanges();
selection.addRange(range);
var newText = range.startContainer.splitText(3);
shouldBeEqualToString('selection.type', 'Range');
shouldBe('selection.anchorNode', 'newText');
shouldBe('selection.anchorOffset', '3');
shouldBe('selection.focusNode', 'newText');
shouldBe('selection.focusOffset', '6');
shouldBeEqualToString('selection.toString()', 'baz');
if (window.testRunner)
    $('container').outerHTML = '';
</script>
<script src="../../resources/js-test.js"></script>
